{include file='common/_meta' /}
<body>
<div class="container">

	<form class="layui-form" action="" lay-filter="form-filter" id="form-article">

		<div class="layui-row">
		  	<div class="layui-form-item">
		    	<label class="layui-form-label">渠道ID：</label>
		    	<div class="layui-input-block">
			     	<input type="text" name="channel_id" value="" autocomplete="off" class="layui-input" disabled>
		    	</div>
		 	</div>
	 	</div>

		<div class="layui-row">
		  	<div class="layui-form-item">
		    	<label class="layui-form-label"><span class="custom-color-red">*</span>ip白名单：</label>
		    	<div class="layui-input-block">
			     	<input type="text" name="channel_ip" value="" autocomplete="off" class="layui-input">
		    	</div>
		 	</div>
	 	</div>
		<div class="layui-row">
		  	<div class="layui-form-item">
		    	<label class="layui-form-label"><span class="custom-color-red">*</span>CMPP IP：</label>
		    	<div class="layui-input-block">
			     	<input type="text" name="client_ip" value="" autocomplete="off" class="layui-input">
		    	</div>
		 	</div>
	 	</div>

		<div class="layui-row">
		  	<div class="layui-form-item">
			    <div class="layui-input-block">
			    	<input type="hidden" name="id"/>
			     	<button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
			    </div>
		  	</div>
	  	</div>

	</form>

</div>
{include file="common/_footer"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
layui.use(['layer', 'form', 'jquery'], function() {

	var layer = layui.layer;
	var form  = layui.form;
	var $     = layui.$;

	form.val("form-filter", {
	  "channel_id": "{$info.channel_id}",
	  "channel_ip": "{$info.channel_ip}",
	  "client_ip": "{$info.client_ip}",
	  "id": "{$info.id}",
	})

	//监听提交
	form.on('submit(formDemo)', function(data) {

		$.ajax({
		    type : "POST",
		    url  : "{:url('Channelip/edt')}",
		    data : $("#form-article").serialize(),
		    success : function(json) {

		        if (json.code == 1) {

		            layer.msg(json.msg,{
	                    icon: 2,
	                    time: 2000,
	                    skin: 'layer-ext-moon'
	                });
	            } else {

	                layer.msg(json.msg,{
	                    icon: 1,
	                    time: 1000,
	                    skin: 'layer-ext-moon'
	                },function() {
	                    parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.$('.btn-refresh').click();
                        parent.layer.close(index);
	                });
	            }
		    },
		    error : function(e) {

		        layer.msg('编辑错误',{icon: 5,time:3000});
		    }
		});

		return false;
	});

});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>